home *** CD-ROM | disk | FTP | other *** search
-
- /********************************************************************/
- /* Boolean class. Copyright by Joe Schell 1989. */
- /********************************************************************/
-
- #ifndef CLASS_boolean
- #define CLASS_boolean
-
- const int TRUE = 1;
- const int FALSE = 0;
-
- class boolean
- {
- int b; // boolean type.
- void value(const int i) { b = (i) ? TRUE : FALSE; }
-
- public:
- boolean() { b = FALSE; }
- boolean(const int i) { value(i); }
- boolean(const boolean &i) { b = i.b; }
-
- operator int() const { return b; }
- operator ~() const { return b ? FALSE : TRUE; }
- boolean &operator=(const int &i) { value(i); return *this; }
- boolean &operator++() { b = b ? FALSE : TRUE; return *this; }
- boolean &operator--() { return (*this)++; }
-
- char *make_string() const { return b ? "true" : "false"; }
-
- }; // End of boolean class.
-
- const boolean true(TRUE), false(FALSE);
-
- #endif
-
-